import { createRouter, createWebHashHistory } from "vue-router";
//createRouter方法用于创建路由器实例，可以管理多个路由
export default createRouter({
  //路由的模式设置
  history: createWebHashHistory(),
  //管理路由
  routes: [
    {
      path: "/",
      redirect: "/home",
    },
    {
      path: "/home",
      component: () => import("@/pages/Home/index.vue"),
    },
    {
      path: "/hospital",
      component: () => import("@/pages/Hospital/index.vue"),
      children:[
        {
          path:'register',
          component:() => import("@/pages/Hospital/Register/index.vue")
        },
        {
          path:'detail',
          component:() => import("@/pages/Hospital/Detail/index.vue")
        },
        {
          path:'notice',
          component:() => import("@/pages/Hospital/Notice/index.vue")
        },
        {
          path:'close',
          component:() => import("@/pages/Hospital/Close/index.vue")
        },
        {
          path:'search',
          component:() => import("@/pages/Hospital/Search/index.vue")
        }
      ]
    },
  ],
  //滚动行为：控制滚动条的位置
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    };
  },
});
